export default {
	namespaced: true,
	state: {
		address: JSON.parse(uni.getStorageSync('address') || '{}'),
		token: uni.getStorageSync('token') || '',
		userInfo: JSON.parse(uni.getStorageSync('userInfo') || '{}')
	},
	mutations: {
		// 更新收货地址
		updataAddress(state, address) {
			state.address = address
			uni.setStorageSync('address', JSON.stringify(state.address))
		},

		setToken(state, token) {
			state.token = token
			uni.setStorageSync('token', token)
		},

		setUserInfo(state, data) {
			state.userInfo = data
			uni.setStorageSync('wxUserInfo', data)
		},
	}
}
